<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class PositionPermissionPivotTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
    	$pivots = [];

    	$permissions =DB::table('permissions')->pluck('code');

    	foreach ($permissions as $permission) {
    		$pivots[] = [
    			'position_id' => 1,
    			'permission_code' => $permission,
			];
		}

		DB::table('position_permission_pivot')->insert($pivots);
    }
}
